
game:setAmbient(0.5,0.5,0.5)
game:setGravity(0.0,-9.81,0.0)


game:createTargetControlLogic("DoNothingControlLogic",{maxForce=0, maxTorque=0},function(_)
end)

game:createActorDesc({name="SimpleBox"},function(_)
	game:BoxShape(_,{position={x=0.0,y=0.0,z=0.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=3.0,y=3.0,z=3.0}})
end)

game:createActorDesc({name="Pingvin"},function(_)
	game:BoxShape(_,{position={x=0.0,y=0.0,z=0.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=3.0,y=5.0,z=3.0}})
end)

game:createActorDesc({name="OgreCastle"},function(_)
	game:BoxShape(_,{position={x=260.0,y=30.0,z=70.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=15.0,y=40.0,z=100.0}})
	game:BoxShape(_,{position={x=-260.0,y=30.0,z=70.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=15.0,y=40.0,z=100.0}})
	game:BoxShape(_,{position={x=260.0,y=30.0,z=-45.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=20.0,y=40.0,z=20.0}})
	game:BoxShape(_,{position={x=-260.0,y=30.0,z=-45.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=20.0,y=40.0,z=20.0}})

	game:BoxShape(_,{position={x=170.0,y=30.0,z=-125.0},rotation={x=0.0,y=50.0,z=0.0},dimension={x=15.0,y=40.0,z=110.0}})
	game:BoxShape(_,{position={x=-170.0,y=30.0,z=-125.0},rotation={x=0.0,y=-50.0,z=0.0},dimension={x=15.0,y=40.0,z=110.0}})
	game:BoxShape(_,{position={x=75.0,y=30.0,z=-195.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=20.0,y=40.0,z=20.0}})
	game:BoxShape(_,{position={x=-75.0,y=30.0,z=-195.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=20.0,y=40.0,z=20.0}})

	game:BoxShape(_,{position={x=0.0,y=30.0,z=-195.0},rotation={x=0.0,y=90.0,z=0.0},dimension={x=15.0,y=40.0,z=60.0}})
end)

game:createActorDesc({name="Sword"},function(_)
	game:BoxShape(_,{position={x=0.0,y=0.0,z=0.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=2.5,y=1.0,z=12.0}})
	game:BoxShape(_,{position={x=0.0,y=0.0,z=5.5},rotation={x=0.0,y=0.0,z=0.0},dimension={x=5.0,y=1.5,z=2.0}})
end)

game:createActorDesc({name="MapElement"},function(_)
	game:BoxShape(_,{position={x=0.0,y=0.0,z=0.0},rotation={x=0.0,y=0.0,z=0.0},dimension={x=2.0,y=2.0,z=2.0}})
end)

--Talaj
game:createNode({x=0.0, y=-30, z=0.0},{x=0.0, y=0.0, z=0.0},{x=3.0, y=1.0, z=3.0},function(node,controlnode)
	game:PhysicsTerrain("Talaj",node,controlnode,{controlLogic="DoNothingControlLogic", collisionGroup=5})
end)

--OgreCastle
game:createNode({x=0.0, y=-30.0, z=-165.0},{x=0.0, y=0.0, z=0.0},{x=2, y=2, z=2},function(node,controlnode)
		game:PhysicsEntity("OgreCastle",node,controlnode,{mesh="OgreCastle.mesh", controlLogic="DoNothingControlLogic",collisionGroup=5, weight=3000000000.0, boundingBox=1.0, isStatic=false, isKinematic=true, actorDesc="OgreCastle"},function(_)
		end)
end)

--OgreCastle
game:createNode({x=0.0, y=-30.0, z=165.0},{x=0.0, y=180.0, z=0.0},{x=2, y=2, z=2},function(node,controlnode)
		game:PhysicsEntity("OgreCastle2",node,controlnode,{mesh="OgreCastle.mesh", controlLogic="DoNothingControlLogic",collisionGroup=5, weight=3000000000.0, boundingBox=1.0, isStatic=false, isKinematic=true, actorDesc="OgreCastle"},function(_)
		end)
end)




-- Map, the base points of the curve path
Map = {
	numberOfPoints = 5,
	point1={x=0,y=0,z=0},
	point2={x=50,y=50,z=0},
	point3={x=30,y=50,z=-100},
	point4={x=0,y=0,z=-200},
	point5={x=50,y=100,z=-300}
	
}

-- BodyRailControlLogic
game:createBodyRailControlLogic("BodyRailControlLogic", {mapBasePoints = Map, resolution = 0.01} )

	
game:createNode({x=0.0, y=0.0, z=-100.0},{x=0.0, y=0.0, z=0.0},{x=1.0, y=1.0, z=1.0},function(node,controlnode)
	game:PhysicsEntity("body",node,controlnode,{mesh="Derins_Sword.mesh", controlLogic="BodyRailControlLogic",collisionGroup=1, weight=300.0,boundingBox=0.1, isStatic=false, isKinematic=true, actorDesc="SimpleBox"},function(_)
	end)
	game:createCamera(node,{name="mainCam"})
	game:addNode(node,controlnode,{x=0.0, y=0.0, z=0.0},{x=0.0, y=0.0, z=0.0},{x=4.0, y=4.0, z=4.0},function(node,controlnode)
		game:PhysicsEntity("kard",node,controlnode,{mesh="OgreCastle.mesh", controlLogic="PlayerControlLogic",collisionGroup=1, weight=300.0, boundingBox=3.95, isStatic=false, isKinematic=true, actorDesc="Sword"},function(_)
		end)
	end)
end)

game:createTargetControlLogic("PingvinControlLogic",{maxForce=5000, maxTorque=0.01},function(_)
	game:Target(_,{position={x=150,y=-20,z=-150},proximityRadius=10, name=""})
	game:Target(_,{position={x=150,y=-20,z=150},proximityRadius=10, name=""})
	game:Target(_,{position={x=-150,y=-20,z=150},proximityRadius=10, name=""})
	game:Target(_,{position={x=-150,y=-20,z=-250},proximityRadius=10, name=""})
end)


game:createTargetControlLogic("TargetControlLogic1",{maxForce=50000, maxTorque=0.01},function(_)
	--game:Target(_,{position={x=0,y=0,z=0},proximityRadius=10, name="kard"})
	game:Target(_,{position={x=-30,y=150,z=-200},proximityRadius=10, name=""})
	game:Target(_,{position={x=100,y=150,z=-300},proximityRadius=10, name=""})
	game:Target(_,{position={x=100,y=70,z=300},proximityRadius=10, name=""})
	game:Target(_,{position={x=-100,y=60,z=300},proximityRadius=10, name=""})
	game:Target(_,{position={x=-100,y=0,z=-300},proximityRadius=10, name=""})
	game:Launcher(_,{mesh="MeatBall.mesh",position={x=0,y=20,z=0},velocity={x=600000,y=600000,z=600000},cooldown=5})
	game:ProjectileTarget(_,{position={x=0,y=-20,z=0},proximityRadius=10, name="Pingvin"})
end)

game:createTargetControlLogic("TargetControlLogic2",{maxForce=50000, maxTorque=0.01},function(_)
	game:Target(_,{position={x=30,y=150,z=-200},proximityRadius=10, name=""})
	game:Target(_,{position={x=-100,y=150,z=-300},proximityRadius=10, name=""})
	game:Target(_,{position={x=100,y=-20,z=300},proximityRadius=10, name=""})
	game:Target(_,{position={x=100,y=-20,z=300},proximityRadius=10, name=""})
	game:Target(_,{position={x=100,y=-20,z=-300},proximityRadius=10, name=""})
	--game:Target(_,{position={x=-100,y=-20,z=-300},proximityRadius=10, name=""})
	game:Launcher(_,{mesh="MeatBall.mesh",position={x=0,y=20,z=0},velocity={x=3000000,y=3000000,z=3000000},cooldown=8})
	game:ProjectileTarget(_,{position={x=0,y=-20,z=0},proximityRadius=10, name="Pingvin"})
end)

game:createTargetControlLogic("TargetControlLogic3",{maxForce=50000, maxTorque=0.01},function(_)
	game:Target(_,{position={x=0,y=200,z=-200},proximityRadius=10, name=""})
	game:Target(_,{position={x=0,y=100,z=250},proximityRadius=10, name=""})
	game:Target(_,{position={x=100,y=100,z=-250},proximityRadius=10, name=""})
	game:Target(_,{position={x=-100,y=100,z=-250},proximityRadius=10, name=""})
	--game:Target(_,{position={x=-100,y=200,z=-300},proximityRadius=10, name=""})
	game:Launcher(_,{mesh="MeatBall.mesh",position={x=0,y=20,z=0},velocity={x=600000,y=600000,z=600000},cooldown=6})
	game:ProjectileTarget(_,{position={x=0,y=-20,z=0},proximityRadius=10, name="Pingvin"})

end)